Different outputs

html document

---    
title: "rmarkdown_pdf"    
author: "Sébastien Renaut"    
date: '2018-09-06'    
output: 
  html_document: 
    toc: yes 
    theme: cerulean 
--- 

Microsoft Word

---  
title: "rmarkdown_docx"  
author: "Sébastien Renaut"  
date: '2018-09-06'  
output: 
  word_document: 
    toc: yes
---   
  • You can specify it when you create a new Rmarkdown document.

  • You can also specify it later in the header.

  • Then, it’s just a matter of kniting the document!

  • Little documentation, few options & configurations are possible (This is probably not the format that should be promoted, as it moves away from an open source environment).

  • Can specify a LibreOffice OpenDocument Text (output: odt_document) or Rich Text Format (output: rtf_document) instead

  • FYI, there is a spellchecker in Rstudio: Edit >Check Spelling…

Portable Document Format (.pdf)

---    
title: "rmarkdown_pdf"    
author: "Sébastien Renaut"    
date: '2018-09-06'    
output: 
  pdf_document:
    keep_tex: true
    toc: yes  
---    
  • You need an extra step to go from a LaTeX (.tex) format to a .pdf. This is handled by the R markdown pdf_document function in R.

  • LaTeX software is a high-quality typesetting system.

  • It is the de facto standard for the communication and publication of scientific documents.

  • LaTeX is available as free software here.

  • If interested, follow this discussion: Why LaTeX is such a bloated system?

  • So…TinyTeX is a custom LaTeX distribution that is small in size (~150MB) but functions well in most cases, especially for R users .

  • tinytex R package is a wrapper function that installs TinyTeX.

Exercice 1

  • If you haven’t done so, install the tinytex R package from the console and run install_tinytex(). It may take a few minutes to download and compile (~150MB).
install.packages("tinytex")  
library(tinytex)  
install_tinytex()  
  • Create a new document, compile it as .pdf.
    • Add a Table of Content.
    • Add a graphic.
  • Now compile it as a Word document (.docx)

  • Add some reference by specifying the csl: ../csl/peerj.csl and bibliography: ../biblio/test_library.bib in the header

LaTeX template

  • This allows further options in the .Rmd file when going from .tex file to .pdf.

  • You can build your own .tex template if you know LaTeX…

  • There are many templates available on the web that you can use.

  • Here is one I like for manuscripts (Thanks svmiller on )

    • For example, using this template, I am writing my first .Rmd manuscript.
       

       
       
  • Here is one I like for Curriculum Vitae
    • For example, using this template, I re-wrote my CV to give it a fresh look!
       
       
       
  • Let’s briefly examine and knit the svm-rmarkdown-cv.Rmd file in the reference_material directory.

  • You should know have all the tools to generate your fully reproducible manuscripts in R.

  • The only real objection I see in formatting manuscript this way is integrating comments from co-authors who do not use R, R markdown, git or github.

Exercice 2

  • R packages rticles is (potentially) a nice package to format articles according to the specification of a journal.

  • But first, you need to install it in the R console.

  • Once installed, try starting a new R markdown document according to your journal of interest.


 

 

  • Right now, few templates available.

  • Some templates may be slower to render (e.g PNAS), depending on what LaTeX package they depend on and need to be downloaded.

Other possibilities

Presentations

---
title: "Untitled"
author: "Sebastien Renaut"
date: "27/02/2019"
output: ioslides_presentation
---
  • You can also generate Powerpoint-like presentations.

Overleaf

  • Overleaf is an online LaTeX and Rich Text collaborative writing and publishing tool that makes the whole process of writing, editing and publishing scientific documents much quicker and easier.

Bookdown

  • Bookdown is an open-source R package that facilitates writing books and long-form articles/reports with R Markdown.